<template>
	<view class="content">
		<view class="note-box">
			<view class="note-item" :class="{active:item.reading==0}" v-for="(item,index) in noticeList" @tap="goPage('/page-home/noteDetails?id='+item.id)">
				<view class="note-top flexWrap">
					<view class="note-title">{{item.titile}}</view>
					<view class="date">{{item.createtime}}</view>
				</view>
				<view class="note-info">{{item.describe}}</view>
				<view class="look-details">查看详情></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				noticeList:[]
			};
		},
		onShow() {
			this.getList();
		},
		methods:{
			getList(){
				this.$request.post(this.$api.noticeList, {
					store_id:uni.getStorageSync('store_id')
				}, {
					token:true
				}).then(res => {
					if (res.code==1) {
						let {
							data = {}
						} = res;
						let newArray =data
						for (let i in newArray) {
							newArray[i].createtime =this.$tools.fDate(this.$tools.formatDate(newArray[i].createtime))
							newArray[i].reading=newArray[i].yd||0
						}
						this.noticeList=newArray
						console.log(this.noticeList)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content{
		padding: 36rpx;
	}
	.note-box{
		.note-item{
			height: 168rpx;
			background: #1D1C5C;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			padding: 30rpx 28rpx;
			margin-bottom: 28rpx;
			.note-top{
				.note-title{
					font-size: 30rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 36rpx;
					@include ellipsis(1);
				}
				.date{
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #8282B3;
					line-height: 36rpx;
					flex: none;
				}
			}
			.note-info{
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #C2C2DA;
				line-height: 40rpx;
				@include ellipsis(2);
				margin: 16rpx 0;
			}
			.look-details{
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #38AAF4;
				line-height: 36rpx;
			}
		}
		.active{
			background-color: #353484;
		}
	}
</style>
